CREATE   procedure dbo.AuditDatabase_Insert(@varcharAuditUserName varchar(50), @varcharAuditGroup varchar(20), @varcharTableName varchar(100), @varcharEventType varchar(100), @varcharBeforeData varchar(3000), @varcharAfterData varchar(3000))
as
declare @errornum int
set @errornum = 0

insert into AuditDatabase(AuditUserName, AuditGroup, TableName, EventType, BeforeData, AfterData) 
values (@varcharAuditUserName, @varcharAuditGroup, @varcharTableName, @varcharEventType, @varcharBeforeData, @varcharAfterData) 
set @errornum = @@ERROR

if @errornum = 0
begin
	SELECT @@IDENTITY
end
else
begin
	SELECT 0
end
